import request from '/@/utils/request';

/**
 * （不建议写成 request.post(xxx)，因为这样 post 时，无法 params 与 data 同时传参）
 *
 * 登录api接口集合
 * @method signIn 用户登录
 * @method signOut 用户退出登录
 */
export function useLoginApi() {
    return {
        signIn: (data: object) => {
            return request({
                url: '/user/manage/login',
                method: 'post',
                data,
            });
        },
        signOut: () => {
            return request({
                url: '/user/manage/logout',
                method: 'post',
            });
        },
        captcha: () => {
            return request({
                url: '/user/manage/base64/captcha',
                method: 'GET',
            });
        },
        userInfo: () => {
            return request({
                url: `user/manage/userinfo`,
                method: 'GET',
            });
        },

        personal: () => {
            return request({
                url: `user/manage/personal`,
                method: 'GET',
            });
        },

        updatePwd: (data: object) => {
            return request({
                url: '/user/manage/updatePwd',
                method: 'post',
                data,
            });
        },
        updateAvatar: (data: object) => {
            return request({
                url: '/user/manage/update/avatar',
                method: 'post',
                data,
            });
        },

    };
}
